import requests
import os
import datetime
import time
import numpy as np
import pandas as pd
import json
from data_prod import data_loader
from model_days import task_days
from model_halfhours import task_halfhours
from config import config_scene
import warnings
warnings.filterwarnings("ignore")
config01 = config_scene()



if __name__ == '__main__':

    url = "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=1002b68d-0e1f-45cc-97e5-b985f08af747"
    headers = {"Content-Type":"application/json"}
    proxies = {'https': 'http://10.210.14.9:3128'}

    try:
        start_t = time.time()
        ###########################################################################
        data_loader()
        task_days()
        task_halfhours()

        msg = str(config01.start_day) + ' online_rider task succeed and runtime:' + str(round((time.time()-start_t)/60,2))
        print(msg)
        r=requests.post(url, headers= headers,json={"msgtype":"text","text":{"content":msg}},proxies=proxies)

    except Exception as e:

        msg = f"online_rider task failed: {e}"
        print(msg)
        r=requests.post(url, headers= headers,json={"msgtype":"text","text":{"content":msg}},proxies=proxies)




